package com.lida.easyExcel.service.Impl;

import com.lida.commonuntils.R;
import com.lida.easyExcel.client.DetailedClient;
import com.lida.easyExcel.entity.ExcelDetailed;
import com.lida.easyExcel.service.ExcelService;
import com.lida.zwservice.entity.DetailedVo;
import com.lida.zwservice.entity.ExcelDetailedVo;
import com.lida.zwservice.entity.PersonalDetailed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;


@Service
public class ExcelServiceImpl implements ExcelService {

    @Autowired
    private DetailedClient client;

    @Override
    public void writeExcel(DetailedVo detaile) {
        List<PersonalDetailed> personalDetaileds = client.writeExcel(detaile);

        String fileName = "D:\\A\\Excel\\write.xlsx";

        EasyExcel.write(fileName, ExcelDetailed.class).sheet("账务列表").doWrite(personalDetaileds);

    }

    @Override
    public R getList(long page, long limit, ExcelDetailedVo excelVo) {
        R excelList = client.getExcelList(page, limit, excelVo);
        return excelList;
    }

}
